package com.ic.controller;

import com.ic.base.BaseController;
import com.ic.base.OperatorType;
import com.ic.base.PageInfo;
import com.ic.entity.ItemUse;
import com.ic.service.ItemUseService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.Map;

/**
 * Description: 领用信息控制层类
 * Author: spark
 * Date  : 2017/6/25
 * Time  : 18:00.
 */
@Controller
@RequestMapping("/itemUseController")
public class ItemUseController extends BaseController {
	@Resource
	private ItemUseService itemUseService;

	/**
	 * 根据查询条件获取领用信息
	 *
	 * @param itemUse  领用信息
	 * @param pageInfo 分页信息
	 * @return 返回Map
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/showItemUseList")
	@ResponseBody
	public Map showItemUseList(ItemUse itemUse, PageInfo pageInfo) {
		return success(itemUseService.showItemUseList(itemUse, pageInfo), OperatorType.SELECT, null);
	}

	/**
	 * 根据领用信息id查看领用信息
	 *
	 * @param itemUseId 领用信息id
	 * @return 返回Map
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/showItemUse")
	@ResponseBody
	public Map showItemUse(String itemUseId) {
		return success(itemUseService.showItemUse(itemUseId), OperatorType.SELECT, null);
	}
}
